﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Text;
using OgilvyOne.BLL;

public partial class SaveContactUs : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
//        接口名:SaveContactUs.aspx
//参数：lang (cn或en)
//      title
//      name
//      email
//      country
//      message
//返回 xml
//<root>
//<result>1</result>
//</root>

        string lang = Request.QueryString["lang"];
        string title = Request.QueryString["title"];
        string name = Request.QueryString["name"];
        string email = Request.QueryString["email"];
        string country = Request.QueryString["country"];
        string message = Request.QueryString["message"];

        StringBuilder sb = new StringBuilder();
        Response.ContentType = "text/xml";
        Response.ContentEncoding = Encoding.UTF8;
        sb.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
        sb.AppendLine(@"<root>");
        //if (!string.IsNullOrEmpty(email))
        //{
            //int checkFlag = new UserBLL().CheckEmailOfContacUs(email);
            //if (checkFlag == 0)
            //{
                int flag = new UserBLL().SaveContacUs(title, name, email, country, message, lang);
                if (flag > 0)
                    sb.Append("<result>1</result>");
                else
                    sb.Append("<result>0</result>");
            //}
            //else
            //{
            //    sb.Append("<result>2</result>");
            //}
        //}
        //else
        //{
        //    sb.Append("<result>3</result>");
        //}
        sb.AppendLine(@"</root>");

        Response.Write(sb.ToString());
    }
}